/*
 * @Author: gezhigang
 * @Date: 2020-05-25 14:31:00
 */
import Vue from "vue";
import App from "./App.vue";
import router from "@/router";
import store from "@/store";
import ElementUI, { Loading } from 'element-ui';
import http from '@/api/http';
// import '@/assets/sass/style.scss'
import 'element-ui/lib/theme-chalk/index.css'
import { isString } from '@/libs/utils';
import moment from 'moment'

Vue.prototype.$ELEMENT = { size: 'mini' }
Vue.use(ElementUI);

Vue.config.productionTip = false;

Vue.prototype.$http = http;
Vue.prototype.$moment = moment

let loadingInstance: any = null;
Vue.prototype.$showLoading = function(options?: Object | string) {
    let text = 'Loading'
    if (isString(options)) {
        text = options + ''
        options = {}
    }

    if (options === void 0) {
        options = {}
    }
    loadingInstance = Loading.service(Object.assign({
        lock: true,
        text: text,
        // spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
    }, options))
}
Vue.prototype.$hideLoading = function() {
    if (loadingInstance) {
        loadingInstance.close()
        loadingInstance = null
    }
}

new Vue({
    router,
    store,
    render: h => h(App)
}).$mount("#app");